using System;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using System.Collections;

namespace ctsu.Shared
{	
	
	public class Constants
	{
		public const string ValidErrorRequiredEmpty = "Required field cannot be empty";
		public const string ValidErrorRangeGreaterThanZero = "Field must be greater than zero";		
		public const string NotifySupport = "Notify support at extension 59157";
		public const string NotifySupportImmediate = "Notify support immediately at extension 59157";        
	}

	public class DbUtils
	{
		private DbUtils()
		{
		}

		public static bool IsKey(string field, DataTable dt)
		{
			foreach(Constraint cs in dt.Constraints ) 
			{
				if(cs is UniqueConstraint)
				{
					UniqueConstraint uCS;
					uCS = (UniqueConstraint)cs;
					// Get the Columns as an array.
					DataColumn[] colArray;
					colArray = uCS.Columns;
					
					for(int i = 0;i<colArray.Length ;i++) 
					{
						if(colArray[i].ColumnName.Equals(field))
							return true;
					}
				}
			}
			return false;
		}
	}

	public class Utils
	{		
		private Utils()
		{			
		}

        public static int GetLeftCenterCoord(int width)
        {
            Rectangle rect = SystemInformation.WorkingArea;
            return (int)((rect.Width - width) / 2);
        }
	}
		
}
